home *** CD-ROM | disk | FTP | other *** search
/ Mastering Web Site Development / Microsoft Mastering Web Site Development (Microsoft) (1997).iso / Media / SampApps / AdvWorks / AWVB5Demo.EXE / AWCreate.SQL < prev    next >
Encoding:
Text File  |  1996-10-04  |  1.1 KB  |  45 lines

  1. SET NOCOUNT ON
  2.  
  3. USE master
  4. GO
  5.  
  6. DECLARE @dttm varchar(55)
  7. SELECT @dttm=convert(varchar,getdate(),113)
  8. RAISERROR('Beginning Install Adventure Works Database.SQL at %s ....',1,1,@dttm) with nowait
  9. GO
  10.  
  11. RAISERROR('Creating Data Device ....',1,1) with nowait
  12. GO
  13.  
  14. DECLARE @NextDeviceNumber int
  15.  
  16. SELECT @NextDeviceNumber = max(convert(tinyint, substring(convert(binary(4), d.low),v.low, 1))) + 1
  17. FROM sysdevices d, master.dbo.spt_values v
  18. WHERE v.type = 'E' AND
  19. v.number = 3 AND
  20. convert(tinyint, substring(convert(binary(4), d.low),v.low, 1)) NOT IN (126, 127)
  21.  
  22. DISK INIT 
  23.  NAME = 'AWData',
  24.  PHYSNAME = 'c:\mssql\data\AWData.dat',
  25.  VDEVNO = @NextDeviceNumber,
  26.  SIZE = 10238
  27. GO
  28.  
  29. RAISERROR('Creating Database ....',1,1) with nowait
  30. GO
  31.  
  32. CREATE DATABASE AWData
  33. ON AWData = 20
  34. GO
  35.  
  36. RAISERROR('Setting Database Option ''Truncate Log on Checkpoint'' To TRUE ....',1,1) with nowait
  37. GO
  38.  
  39. sp_dboption 'AWData', 'trunc. log on chkpt.', true
  40. GO
  41.  
  42. DECLARE @dttm varchar(55)
  43. SELECT @dttm=convert(varchar,getdate(),113)
  44. RAISERROR('Completed Adventure Works Database.SQL at %s.',1,1,@dttm) with nowait
  45. GO